<template>
  <el-dialog
    top="7vh"
    :width="width"
    v-bind="$attrs"
    destroy-on-close
    v-on="$listeners"
  >
    <slot></slot>
    <template slot="footer">
      <span class="dialog-footer">
        <el-button v-if="showCancel" @click="$emit('close')">取 消</el-button>
        <el-button
          type="primary"
          :loading="okLoading"
          :disabled="okDisabled"
          @click="$emit('ok')"
        >
          {{ saveText }}
        </el-button>
      </span>
    </template>
  </el-dialog>
</template>
<script>
export default {
  name: "MyDialog",
  props: {
    centered: {
      type: Boolean,
      default: true,
    },
    height:{
      type: String,
      default: "auto",
    },
    width: {
      type: String,
      default: "800px",
    },
    okLoading: {
      type: Boolean,
      default: false,
    },
    okDisabled: {
      type: Boolean,
      default: false,
    },
    showCancel: {
      type: Boolean,
      default: false,
    },
    saveText: {
      type: String,
      default: "确定",
    },
  },
};
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__body {
  max-height: 70vh;
  overflow: auto;
}
</style>
